//
//  myGuideViewController.m
//  MobiProject
//
//  Created by 阔 李 on 16/8/1.
//  Copyright © 2016年 yxnzb. All rights reserved.
//

#import "myGuideViewController.h"

@implementation myGuideViewController

-(void)viewDidLoad{
    [super viewDidLoad];
    
    self.myTableview.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.myTableview.bounces=NO;
    
    [AppDelegate storyBoradAutoLay:self.view];
    
    [UIView animateWithDuration:2.5 animations:^(void) {
        startImage.alpha = 0;
    } completion:^(BOOL finished) {
        mainView.hidden=NO;
    }];
}
- (void)viewWillAppear:(BOOL)animated
{
    [self.navigationController setNavigationBarHidden:YES animated:animated];
    [super viewWillAppear:animated];
    mainView.hidden=YES;
}
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillAppear:animated];
}
// 进入应用
-(void)btnClick:(UIButton*)sender{
    
    [UIView animateWithDuration:0.3 animations:^{
    } completion:^(BOOL finished) {
        //[self removeFromSuperview];
        [startImage removeFromSuperview];
        [mainView removeFromSuperview];
        
        UIStoryboard *mainStroyBoard=[UIStoryboard storyboardWithName:@"Main" bundle:nil];
        
        UIViewController *registVC=[mainStroyBoard instantiateViewControllerWithIdentifier:@"RegisterSelect"];
        [self.navigationController pushViewController:registVC animated:NO];
    }];
}

#pragma mark - 数据源方法
#pragma mark 返回分组数
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
#pragma mark 返回每组行数
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

#pragma mark返回每行的单元格
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *citySearchIdentifier = @"myGuide";
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:citySearchIdentifier];
    if (cell == nil){
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:citySearchIdentifier];
        cell.backgroundColor =[UIColor yellowColor];
        cell.selectionStyle = UITableViewCellSelectionStyleNone; // 选中类型
    }
    return cell;
}
#pragma mark - UITableViewDelegate
// 当每一行的cell的高度不一致的时候就使用代理方法设置cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return (300);
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return (50);
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return (50);
}
- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    // 头view
    UIView *headView=[[UIView alloc]init];
    headView.backgroundColor=[UIColor redColor];
    return headView;

}
- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    // 尾 view
    UIView *footerView=[[UIView alloc]init];
    footerView.backgroundColor=[UIColor redColor];
    
    UIButton *goBtn=[[UIButton alloc]initWithFrame:CGRectMake(0,0,(275),(50))];
    goBtn.backgroundColor=[UIColor greenColor];
    [goBtn setTitle:@"进入应用" forState:UIControlStateNormal];
    [goBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [goBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [footerView addSubview:goBtn];
    return footerView;
}
@end
